package com.microcm.common;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;

public class CFUtils
{
	/**
	 * 进行两次encode，为的是request能正确decode
	 * 
	 * @author kansum
	 */
	public static String urlEncode(String word) throws UnsupportedEncodingException
	{
		String _k = URLEncoder.encode(word, "UTF-8");
		return URLEncoder.encode(_k, "UTF-8");
	}

	/**
	 * 将request接收到的值进行正确decode
	 * 
	 * @author kansum
	 */
	public static String urlDecode(String word) throws UnsupportedEncodingException
	{
		return URLDecoder.decode(word, "UTF-8");
	}
}
